<?php

// Define path to root directory
defined('ROOT_PATH')
    || define('ROOT_PATH', realpath(dirname(__FILE__) . '/..'));

// Define path to application directory
defined('APPLICATION_PATH')
    || define('APPLICATION_PATH', ROOT_PATH . '/application');

// Define path to configs directory
defined('CONFIG_PATH')
    || define('CONFIG_PATH', APPLICATION_PATH . '/configs');

// Define application environment
defined('APPLICATION_ENV')
    || define('APPLICATION_ENV', (getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') : 'production'));

// Ensure library/ is on include_path
set_include_path(implode(PATH_SEPARATOR, array(
    realpath(ROOT_PATH . '/library-internal'),
    realpath(ROOT_PATH . '/library'),
    realpath(ROOT_PATH),
    get_include_path(),
)));

/** Zend_Application */
require_once 'Zend/Application.php';
require_once APPLICATION_PATH . '/Manager.php';

// Create application, bootstrap, and run
$application = new Zend_Application(APPLICATION_ENV, CONFIG_PATH . '/application.ini');
$application->bootstrap();
$application->run();
